DUMP=DUMP
LONG=NONE
CASE=apb_case0
UVM_INFO=UVM_LOW
MRATE=TDM
##MRATE=HDM
##MRATE=TENM
MODE=NORMAL
COMPILE_TIME = $(shell date +"%Y-%m-%d-%H-%M-%S")
SEED=0
LEN=2048
MAX=10000
MIN=-10000

GUI=NONE

verdi_path = /usr/synopsys/Verdi3_L-2016.06-1


ifeq ("$(GUI)","GUI")
GUI_OPTS += -gui=verdi
UVM_OPTS += +UVM_VERDI_TRACE="UVM_AWARE+RAL+HIER+COMPWAVE" +UVM_TR_RECORD +UVM_LOG_RECORD  
else
GUI_OPTS += "" 	
UVM_OPTS += ""
endif

VCS_OPTS +=  -full64 
VCS_OPTS +=  -cpp g++-4.8 -cc gcc-4.8 
VCS_OPTS +=  -lca -kdb  
VCS_OPTS +=  -timescale=1ns/1ps   
VCS_OPTS +=  -P  $(verdi_path)/share/PLI/VCS/LINUX64/novas.tab   $(verdi_path)/share/PLI/VCS/LINUX64/pli.a 
VCS_OPTS +=  +vcs+lic+wait

##VCS_OPTS +=  -sverilog +verilog2001ext+.v  +lint=TFIPC-L  -ntb_opts uvm
VCS_OPTS +=  -sverilog +verilog2001ext+.v  +lint=TFIPC-L  
##VCS_OPTS +=  -sverilog ../../uvm-1.1d/src/dpi/uvm_dpi.cc  -CFLAGS -DVCS  +verilog2001ext+.v  +lint=TFIPC-L  

#VCS_OPTS +=  +define+UVM_NO_DEPRECATED+UVM_OBJECT_MUST_HAVE_CONSTRUCTO  
VCS_OPTS +=  -debug_all 

CASE_OPTS +=  +ntb_random_seed=${SEED}
##CASE_OPTS +=  +ntb_random_seed_automatic

##VCS_OPTS += -debug_access+pp


#ERR_OPTS += UVM_MAX_QUIT_COUNT=10,NO
COV_OPTS +=  -cm line+cond+fsm+tgl+branch+assert -cm_dir ./cov_info 
#CASE_OPTS += +UVM_TESTNAME=${CASE} +UVM_VERBOSITY=${UVM_INFO} 

default:
	echo "\`define  $(DUMP)       "  >    define.v ; 
	echo "\`define  $(LONG)       "  >>   define.v ;
	echo "\`define  $(UVM_INFO)       "  >>   define.v ;
	echo "\`define  $(MODE)       "  >>   define.v ;
	echo "\`define  LEN  $(LEN)       "  >>   define.v ;
	vcs  $(VCS_OPTS)   -f ./all.f -top  tb_top  $(COV_OPTS)   $(UVM_OPTS)    -l vcs_com.log ; 
	./simv        $(CASE_OPTS)    $(COV_OPTS)  $(ERR_OPTS)     -l vcs_sim.log      $(GUI_OPTS)   $(UVM_OPTS)

verdi:
	  verdi -sv  -f ./all.f  -top tb_top &

verdi_simv:
	verdi  -elab simv.daidir/kdb  &
dve:
	dve -full64 -vpd vcdplus.vpd &

clean:
	rm -rf *simv*  *csrc   *~ verdiLog  novas*  ucli.key  *.vpd  *.fsdb  vc_hdrs.h  *.log *case*   my_verdi   cov_report  DVEfiles   

cov:
	urg   -full64  -dir     ./*case*/cov_info.vdb    -metric line+cond+fsm+tgl -report   ./cov_report   -format both
	/home/software/firefox/firefox  ./cov_report/hierarchy.html  &

grep:
	grep "CASE"  ./*case*/vcs*.log


fc:
	rm -rf float2bin  float_add_2bin_test  float_mul_2bin_test
	gcc -o float2bin float2bin_test.c
	gcc -o float_add_2bin_test   float_add_2bin_test.c  
	gcc -o float_mul_2bin_test   float_mul_2bin_test.c  

fr:
	./float2bin             $(LEN)  
	./float_add_2bin_test   $(LEN)  $(MAX)  $(MIN)
	./float_mul_2bin_test   $(LEN)  $(MAX)  $(MIN)


unix:
	dos2unix  run*
